package com.daylive.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.daylive.model.CosmetologyRecords;
import com.daylive.page.Page;
import com.daylive.service.CosmetologyRecordsService;


@Controller
@RequestMapping("cosmetologyRecords")
public class CosmetologyRecordsController {
	@Autowired
	private CosmetologyRecordsService  cosmetologyRecordsService;

	@RequestMapping("/cosmetologyRecords_list.do")
	public ModelAndView getCosmetologyRecordsList() {
		return getCosmetologyRecordsList(null,1);
	}
	@RequestMapping("/cosmetologyRecords_page_list.do")
	public ModelAndView getCosmetologyRecordsList(@RequestParam String account,@RequestParam int pageNumber) {
		ModelAndView mv = new ModelAndView("cosmetologyRecords_list");
		try {
			Page<CosmetologyRecords> pageList = cosmetologyRecordsService.getCosmetologyRecordsList(account,pageNumber);
			mv.addObject("totalPage", pageList.getTotalPage());
			mv.addObject("totalCount", pageList.getTotalCount());
			mv.addObject("cosmetologyRecordsList", pageList.getResultList());
			mv.addObject("currentPage", pageNumber);
			mv.addObject("account", account);
		} catch (Exception e) {
			ModelAndView mv1 = new ModelAndView("error");
			mv1.addObject("msg", "查询数据库出错！");
		}
		return mv;
	}

}